<?php
$this->breadcrumbs=array(
    Yii::t('site','Admin') => array('/admin'),
    Yii::t('site','Users') => array('admin'),
    Yii::t('site','Manage'),
);

$this->menu=array(
    array('label'=>Yii::t('site','New User'), 'url'=>array('create')),
    array('label'=>Yii::t('site','List Users'), 'url'=>array('index')),

);

Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$.fn.yiiGridView.update('user-grid', {
		data: $(this).serialize()
	});
	return false;
});
");
?>

    <h1><?php echo Yii::t('site','Manage Users'); ?></h1>

<p>
You may optionally enter a comparison operator (<b>&lt;</b>, <b>&lt;=</b>, <b>&gt;</b>, <b>&gt;=</b>, <b>&lt;&gt;</b>
or <b>=</b>) at the beginning of each of your search values to specify how the comparison should be done.
</p>

<?php echo CHtml::link(Yii::t('site','Advanced Search'),'#',array('class'=>'search-button')); ?>
<div class="search-form" style="display:none">
<?php $this->renderPartial('_search',array(
	'model'=>$model,
)); ?>
</div><!-- search-form -->

<?php $this->widget('zii.widgets.grid.CGridView', array(
    'id'=>'user-grid',
    'dataProvider'=>$model->search(),
    'filter'=>$model,
    'columns'=>array(
        array(
            'class'=>'EButtonColumnWithClearFilters', // 'CButtonColumn',
            'imageUrl'=>Yii::app()->baseUrl.'/images/icons/filter_clear.png',
            'template'=>'{view}{update}',
        ),
        'id',
        'lastName',
        'firstName',
        'username',
        array(
            'name'=>'registrationComplete',
            'type'=>'raw',
            'value'=>'$data->registrationComplete ? \'[X]\' : \'-\'',
            'filter'=>MyModel::getYesNoOptions()
        ),
        array(
            'name'=>'email',
            'type'=>'raw',
            'value'=>'CHtml::mailto($data->email,$data->email."?Subject=".rawurlencode("[".Yii::app()->name."] ")."&Body=".rawurlencode("Hello ".$data->firstName." ".$data->lastName.","))',
        ),
        array(
            'name'=>'lastLoginTimestamp',
            'type'=>'raw',
            'value'=>'$data->lastLoginTimestamp>0 ? Yii::app()->dateFormatter->formatDateTime($data->lastLoginTimestamp,\'medium\',\'long\') : \'&ndash;\''
        ),
        array(
            'class'=>'CButtonColumn',
            'template'=>'{delete}',
        ),
    ),
)); ?>
